configure_file(${CMAKE_CURRENT_SRC_DIR}include/config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.hpp)

file(GLOB SCRIPTKIT_SRCS 			src/*.cpp)
file(GLOB SCRIPTKIT_INCS 			include/*.hpp ${CMAKE_CURRENT_BINARY_DIR}/include/*.hpp)

# for MSVC, others
source_group("ScriptKit Sources" FILES ${SCRIPTKIT_SRCS})
source_group("ScriptKit Headers" FILES ${SCRIPTKIT_INCS})

include_directories(include ${SPIDERMONKEY_INCLUDE_DIR} ${V8_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include ${Boost_INCLUDE_DIR})

add_library(ScriptKit SHARED                        ${SCRIPTKIT_SRCS} ${SCRIPTKIT_INCS})

add_definitions(-DSCRIPTKIT_DLL)

#set_target_properties(ScriptKit PROPERTIES          OUTPUT_NAME ScriptKit)
set_target_properties(ScriptKit PROPERTIES          LINKER_LANGUAGE CXX)
set_target_properties(ScriptKit PROPERTIES 			DEFINE_SYMBOL "SCRIPTKIT_EXPORTS")
set_target_properties(ScriptKit PROPERTIES          VERSION ${ScriptKit_VERSION}
                                                 SOVERSION ${ScriptKit_VERSION_MAJOR})

set(SCRIPTKIT_LIBS ${SCRIPTKIT_LIBS} ${SPIDERMONKEY_LIBRARY} ${V8_LIBRARY})
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  set(SCRIPTKIT_LIBS ${SCRIPTKIT_LIBS} c dl)
endif()

target_link_libraries(ScriptKit ${SCRIPTKIT_LIBS} ${Boost_LIBRARIES})

#add_library(ScriptKit_static STATIC                 ${SCRIPTKIT_SRCS} ${SCRIPTKIT_INCS})

#set_target_properties(ScriptKit_static PROPERTIES   OUTPUT_NAME ScriptKit_static)
#set_target_properties(ScriptKit_static PROPERTIES   LINKER_LANGUAGE CXX )

#target_link_libraries(ScriptKit_static ${SCRIPTKIT_LIBS})


